package com.itheima.controller;

import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.xml.ws.RequestWrapper;

@Controller
//类上方配置的请求映射与方法上面配置的请求映射连接在一起。形成完整的请求映射路径
@RequestMapping("/user")
public class UserController {
    //注入
    @Autowired
    public UserService userService;

    //设置映射路径为/save 外部访问路径
    @RequestMapping("/save")

    //设置当前操作返回结果为指定json数据，本质是一个字符串信息
    @ResponseBody
    public String save() {
        userService.user();
        System.out.println("user save...");
        return "{'info':'springmvc'}";
    }
}
